package org.hawk.gwt.ppc.reflect.lang.mock;

import java.io.Serializable;

public class Mock3 extends Mock1 implements Mock2, Serializable{
	public static final long serialVersionUID = 3035427785512584512L;
	
	private Mock3 parent;
	private volatile String name;
	
	public Mock3(){
		name = "?";
	}
	
	protected Mock3(Mock3 parent){
		this(null,parent);
	}
	
	private Mock3(String name,Mock3 parent){
		this.parent = parent;
		this.name = name;
	}
	
	protected void doSomething(){
		doSomething(MOD);
	}

	private void doSomething(int mod) {
	}

	public int getIntValue(String str, int additional) {
		return additional;
	}

	public Mock3[] getParent() {
		return new Mock3[]{parent};
	}

	public String getName() {
		return name;
	}
	public static final org.hawk.gwt.ppc.reflect.lang.ClassDelegate<Mock3> $class = 
	new org.hawk.gwt.ppc.reflect.lang.ClassDelegate<Mock3>(Mock3.class) {
		protected Class<?>[] getImplementedInterfaces(){
			return new Class[]{
				org.hawk.gwt.ppc.reflect.lang.mock.Mock2.class,
				java.io.Serializable.class
			};
		}

		protected String[] getConstructorSignatures(){
			return new String[]{
				"Mock3()",
				"Mock3(org.hawk.gwt.ppc.reflect.lang.mock.Mock3)",
				"Mock3(java.lang.String,org.hawk.gwt.ppc.reflect.lang.mock.Mock3)"
			};
		}

		protected String[] getFieldsSignatures(){
			return new String[]{
				"serialVersionUID",
				"parent",
				"name"
			};
		}

		protected String[] getMethodSignatures(){
			return new String[]{
				"doSomething()",
				"doSomething(int)",
				"getIntValue(java.lang.String,int)",
				"getParent()",
				"getName()"
			};
		}

		protected int[] getInterfacesIndices(Object accessor){
			super.getInterfacesIndices(accessor);
			return new int[]{0,1};
		}

		public int getModifiers(Object accessor,String signature){
			int sign = 0;
			if(signature.equals(""))sign|=1;
			else if(signature.equals("Mock3()"))sign|=1;
			else if(signature.equals("Mock3(java.lang.String,org.hawk.gwt.ppc.reflect.lang.mock.Mock3)"))sign|=2;
			else if(signature.equals("Mock3(org.hawk.gwt.ppc.reflect.lang.mock.Mock3)"))sign|=4;
			else if(signature.equals("doSomething()"))sign|=4;
			else if(signature.equals("doSomething(int)"))sign|=2;
			else if(signature.equals("getIntValue(java.lang.String,int)"))sign|=1;
			else if(signature.equals("getName()"))sign|=1;
			else if(signature.equals("getParent()"))sign|=1;
			else if(signature.equals("name"))sign|=66;
			else if(signature.equals("parent"))sign|=2;
			else if(signature.equals("serialVersionUID"))sign|=25;
			return super.getModifiers(accessor, signature)|sign;
		}

		public Mock3 create(Object accessor,String signature,Object[] initargs) throws Throwable{
			super.create(accessor, signature, initargs);
			if(signature.equals("Mock3()"))return new Mock3();
			if(signature.equals("Mock3(org.hawk.gwt.ppc.reflect.lang.mock.Mock3)"))return new Mock3((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)initargs[0]);
			if(signature.equals("Mock3(java.lang.String,org.hawk.gwt.ppc.reflect.lang.mock.Mock3)"))return new Mock3((java.lang.String)initargs[0], (org.hawk.gwt.ppc.reflect.lang.mock.Mock3)initargs[1]);
			return null;
		}

		public Class<?> getFieldType(Object accessor,String name){
			super.getFieldType(accessor, name);
			if(name.equals("serialVersionUID"))return long.class;
			if(name.equals("parent"))return org.hawk.gwt.ppc.reflect.lang.mock.Mock3.class;
			if(name.equals("name"))return java.lang.String.class;
			return null;
		}

		public Object get(Object accessor,String name,Object obj){
			super.get(accessor, name, obj);
			if(name.equals("serialVersionUID"))return org.hawk.gwt.ppc.reflect.lang.mock.Mock3.serialVersionUID;
			if(name.equals("parent"))return ((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).parent;
			if(name.equals("name"))return ((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).name;
			return null;
		}

		public void set(Object accessor,String name,Object obj,Object value){
			super.set(accessor, name, obj, value);
			if(name.equals("parent"))((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).parent=(org.hawk.gwt.ppc.reflect.lang.mock.Mock3)value;
			else if(name.equals("name"))((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).name=(java.lang.String)value;
		}

		public Class<?> getReturnType(Object accessor,String signature){
			super.getReturnType(accessor, signature);
			if(signature.equals("doSomething()"))return void.class;
			if(signature.equals("doSomething(int)"))return void.class;
			if(signature.equals("getIntValue(java.lang.String,int)"))return int.class;
			if(signature.equals("getParent()"))return org.hawk.gwt.ppc.reflect.lang.mock.Mock3[].class;
			if(signature.equals("getName()"))return java.lang.String.class;
			return null;
		}

		public Object invoke(Object accessor,String signature,Object obj,Object[] parameters) throws Throwable{
			super.invoke(accessor, signature, obj, parameters);
			if(signature.equals("doSomething()"))((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).doSomething();
			if(signature.equals("doSomething(int)"))((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).doSomething((java.lang.Integer)parameters[0]);
			if(signature.equals("getIntValue(java.lang.String,int)"))return ((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).getIntValue((java.lang.String)parameters[0], (java.lang.Integer)parameters[1]);
			if(signature.equals("getParent()"))return ((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).getParent();
			if(signature.equals("getName()"))return ((org.hawk.gwt.ppc.reflect.lang.mock.Mock3)obj).getName();
			return null;
		}

		public Object createArray(Object accessor,int[] dimensions){
			super.createArray(accessor, dimensions);
			switch (dimensions.length) {
			case 1: return new Mock3[dimensions[0]];
			case 2: return new Mock3[dimensions[0]][dimensions[1]];
			case 3: return new Mock3[dimensions[0]][dimensions[1]][dimensions[2]];
			case 4: return new Mock3[dimensions[0]][dimensions[1]][dimensions[2]][dimensions[3]];
			case 5: return new Mock3[dimensions[0]][dimensions[1]][dimensions[2]][dimensions[3]][dimensions[4]];
			}
			return null;
		}
	};
}
